#pragma once
#include <map>
#include <string>
#include <vector>
#include "OgreVector3.h"

namespace Ogre {
	class ManualObject;
	class SceneManager;
	class Entity;
	class MeshSerializer;
	class ResourceGroupManager;
	class MeshManager;
}
struct Triangle;
class OgreInitializeSettings;
enum LCC;

class Page {
	public:
		Page(double minX, double minZ, double maxX, double maxZ, Ogre::SceneManager* manager, int lods, OgreInitializeSettings* init, int id, Ogre::ResourceGroupManager* rmanager, const char* tername);
		virtual ~Page();
		double* getCoords();
		void fillMap(LCC type, Triangle* tri, unsigned char lod);
		void setElevationExtrema(double min, double max);
		void compile();
		void printCoords();

	protected:
		void cleanup();
		void removeLod(int lod);
		void deleteLod(int lod);
		void removeAllLods();
		void deleteAllLods();
		void loadLod(int lod);
		void loadAllLods();
		void loadLodFrom(int lod);
		double minX;
		double minZ;
		double maxX;
		double maxZ;
		double minY;
		double maxY;
		int lods;
		Ogre::Vector3 middle;
		std::vector<std::multimap<LCC, Triangle*>*> maps;
		std::vector<Ogre::Entity*> entities;
		Ogre::SceneManager* manager;
		Ogre::ResourceGroupManager* rmanager;
		std::string name;
		Ogre::MeshSerializer* ms;
		Ogre::MeshManager* mm;
		OgreInitializeSettings* init;
		std::string path;
};
